using System;
using System.Collections.Generic;
// =============================================
// Author:		Onur Eker
// Create date: <Create Date,,>
// Description:	<Description,,>
// =============================================
using System.Data;
using System.Text;
using Bosphorus.Migrator.Core;
using Bosphorus.Migrator.Core.MigrationCommand;
using Bosphorus.Migrator.Implementation.MigrationCommand;
using Bosphorus.Migrator.Model;

namespace Bosphorus.Migrator.Facade.DdlSignature.Table
{
    public class CreateTableSignature<TDdlSignature> : TableSignature<TDdlSignature>
        where TDdlSignature : CreateTableSignature<TDdlSignature>
    {
        public CreateTableSignature(ICommand command)
            : base(command)
        {
        }

        public TDdlSignature Add<T>(string name, SqlDbType dataType) where T : Column
        {
            return Add<T>(name, dataType, 0, true);
        }

        public TDdlSignature Add<T>(string name, SqlDbType dataType, int size) where T : Column
        {
            return Add<T>(name, dataType, size, true);
        }

        public TDdlSignature Add<T>(string name, SqlDbType dataType, bool nullable) where T : Column
        {
            return Add<T>(name, dataType, 0, nullable);
        }

        public TDdlSignature Add<T>(string name, SqlDbType dataType, int size, bool nullable) where T : Column
        {
            Column column = new Column();
            column.Name = name;
            column.DataType = dataType;
            column.Size = size;
            column.Nullable = nullable;

            return AddCreateSubCommand<Column>(column);
        }
    }

    public class CreateTableSignature : CreateTableSignature<CreateTableSignature>
    {
        public CreateTableSignature(ICommand command)
            : base(command)
        {
        }
    }
}